import http from './request'

const account = {
    login(params) {
        return http.post('login', params)
    }
}

const getApi = {
    getUser(params) {
        return http.get('users', { params })
    },
    searchUser(id) {
        return http.get('users/' + id)
    },
    getGoods(params) {
        return http.get('goods', { params })
    },
    searchGoods(id) {
        return http.get('goods/' + id)
    },
    getList(params) {
        return http.get('orders', { params })
    }
}

const postApi = {
    addUser(params) {
        return http.post('users', params)
    }
}

const deletApi = {
    delUser(id) {
        return http.delete(`users/${id}`)
    },
    deleGoods(id) {
        return http.delete(`goods/${id}`)
    }
}

const putApi = {
    editGoods(id, params) {
        return http.put(`goods/${id}`, params)
    }
}
export { account, getApi, deletApi, postApi, putApi }